<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %> 
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %> 
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
 <meta name="renderer" content="webkit">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>项目流程跟踪页面</title>
<jsp:include page="../../import.jsp" flush="true" />
</head>
<body class="iframeBody">
<div class="Wrapper">
<div class="searchArea">
	<div class="fieldBox" style="display:none;">
		<input name="prjId" id="prjId" type="text" class="ui-textbox" value="${prjId}">
	</div>
</div>
<div id="ligergrid1" class="sq-grid"></div> 
</div>

<script type="text/javascript">
	var grid = null;
	$(function () {
		grid = $("#ligergrid1").ligerGrid({
	    	url: '<%=path%>/project/audit/initPorjectFlowList.do?prjId=${prjId}',
	    	method : 'get',
	        columns: [
				{ display: '业务数据编号', name: 'grpFlag', minwidth: 120 , enabledSort:true},
				{ display: '流程名称', name: 'pno', minWidth: 180 , align:'center', enabledSort:true,
					render: function (rowdata, rowindex, value, column) { 
						var h = '';
						h='<a href="javascript:commShowFlow(';
				        h+="'"+rowdata.pinstId+"',"; //流程实例ID
				        h+="'"+rowdata.audStsCd+"',"; //审核状态
				        h+="'"+rowdata.dataId+"',"; //业务主键ID
				        h+="'"+rowdata.busTyp+"',"; //业务类型
				        h+="'"+rowdata.buOrgCd+"',"; //所属事业部
				        h+="'"+rowdata.orgCd+"'"; //组织架构
						h+=')">'+value+'</a>';
						return h;
				}},
				{ display: '状态', name: 'audStsCd', minwidth: 120, enabledSort:true,
					render: function (rowdata, rowindex, value, column) { 
						var h = '';
						if(rowdata.audStsCd=="0"){
							h = '待提交';
						}else if(rowdata.audStsCd=="1"){
							h = '审核中';
						}else if(rowdata.audStsCd=="2"){
							h = '审核通过';
						}else if(rowdata.audStsCd=="3"){
							h = '审核不通过';
						}else if(rowdata.audStsCd=="4"){
							h = '驳回呈报人';
						}else if(rowdata.audStsCd=="5"){
							h = '呈报人处理';
						}else if(rowdata.audStsCd=="6"){
							h = '呈报人知悉';
						}else if(rowdata.audStsCd=="7"){
							h = '预审审核中';
						}else if(rowdata.audStsCd=="8"){
							h = '预审审核通过';
						}else if(rowdata.audStsCd=="9"){
							h = '预审驳回呈报人';
						}else if(rowdata.audStsCd=="10"){
							h = '预审审核不通过';
						}
						return h;
					}},
				{ display: '创建人', name: 'crtUsrName', minwidth: 120 , enabledSort:true},
				{ display: '创建时间', name: 'pCrtTm', minWidth: 140 , render:renderDate, enabledSort:false},
	        ],
	        //pageSize:10,
	        usePager:false,
	        root:'rows',
	        record:'total',
	        hideLoadButton : true,
	        width: '100%',
	        height:'100%',
	        heightDiff:-2,
	        checkbox:false,
	        rownumbers:true,
	        onAfterShowData: function ()
            {
                $('#ligergrid1').rowspan('grpFlag');
            }
	    });
	    grid = liger.get("ligergrid1");
	    grid.setHeight(100);
	    $("#searchBar").ligerForm();
	    $("#searchBtn").click(function(event) {
	         var form = new liger.get("searchBar");
	         var data = form.getData();
	         data["crtTm"] = $("#crtTm").val();
	         for (name in data){
	            grid.setParm(name,data[name]);
	         };
	        grid.reload();
	    });
	
	    $("#pageloading").hide();
	
	});
	
	function commShowFlow(pinstId, audStsCd, dataId, busTyp, buOrgCd, orgCd){
		if(StringUtils.isEmpty(pinstId)){
    		UIUtils.alertWarning(CommonConstant.C_P_INSTANCEID_NOT_HERE);
    		return;
    	}
		var orgCd_1 = '';
		if(StringUtils.isNotEmpty(orgCd)){
			orgCd_1 = orgCd.substring(0,12);
		}
		var prjTypCd = '${prjTypCd}';
		var _formUrl = "";
		if(busTyp=='001' && buOrgCd==ProjectConstant.CODE_BU_ORG_CD_CAR){//乘用车立项流程
			_formUrl = "/project/audit/toCarBizAdditionalInfoPage.do?isDetail=1"+"@@processInstanceId="+pinstId+"@@projectId=";
		}else if(busTyp=='001' && buOrgCd==ProjectConstant.CODE_BU_ORG_CD_ZC){//专车立项流程
			if(orgCd_1=='000000080002'){//专车客车
				_formUrl = "/project/audit/toBusAdditionalInfoPage.do?isBusKC=1@@isDetail=1"+"@@processInstanceId="+pinstId+"@@projectId=";
			}else{
				_formUrl = "/project/audit/toBusAdditionalInfoPage.do?isDetail=1"+"@@processInstanceId="+pinstId+"@@projectId=";
			}
		}else if(busTyp=='001'){//重卡立项流程
			if(prjTypCd=='DSFGHKDCPSZ'){
				_formUrl = "/project/audit/toTempAdditionalInfoPage.do?isDetail=1"+"@@processInstanceId="+pinstId+"@@projectId=";
			}else{
				_formUrl = "/project/audit/toAdditionalInfoPage.do?isDetail=1"+"@@processInstanceId="+pinstId+"@@projectId=";
			}
		}else if (busTyp=='002' || busTyp=='007' || busTyp=='008' || busTyp=='025'){
			if(buOrgCd==ProjectConstant.CODE_BU_ORG_CD_CAR){//乘用车放款
				_formUrl = "/capital/capPayInfo/toAddPage.do?accCtrl=1@@ctrlKey=3@@id=";
			}else{//重卡放款
				_formUrl = "/capPay/flow/toAdditionalInfoPage.do?capPayId=";
			}
		}else if(busTyp=='011'){//正常结清
			_formUrl = "/project/prjprdpayschm/settleFlowPage.do?paySchId=";
		}else if(busTyp=='012'){//提前结清
			if(buOrgCd==ProjectConstant.CODE_BU_ORG_CD_CAR){//汽车金融结清
				_formUrl = "/project/prjprdpayschm/carPreSettleFlowPage.do?paySchId=";
			}else{
				_formUrl = "/project/prjprdpayschm/preSettleFlowPage.do?paySchId=";
			}
		}else if(busTyp=='014'){//添加风险保证金
			_formUrl = "/project/prjprdpayschm/toRickDepDetailPage.do?id=";
		}else if(busTyp=='010'){//续保
			_formUrl = "/insurance/insPlcBscInfo/toCheckPage.do?id=";
		}else if(busTyp == '016' || busTyp == '042'){//拖车管理处置
    		 _formUrl = "/ass/assTrailCarD/toDealViewPage.do?deal_Id=";
    	}else if(busTyp == '017' || busTyp == '040'){//拖车审批
    		 _formUrl = "/ass/assTrailCarM/toInfoViewPage.do?tcMasterId=";
    	}else if(busTyp == '018' || busTyp == '041'){//拖车赎回
    		 _formUrl = "/ass/assTrailCarD/toRedeemViewPage.do?redeem_Id=";
    	}else if(busTyp == '019'){//优车处置
            _formUrl = "/ass/assTrailCarD/toYCDealViewPage.do?processInstanceId=" + pinstId + "@@yc_deal_Id=";
    	}else if(busTyp == '020'){//转优车
    		 _formUrl = "/ass/assTrailCarD/toOptimalViewPage.do?optimal_Id=";
    	}else if(busTyp == '009'){//罚息减免
    		 _formUrl = "/capital/capFund/reduFineApply.do?ctrlKey=3@@vfId=";
    	}else if(busTyp == 'FS01'){//
            _formUrl = "/risk/overdueCollect/toFileSupplyActvitiPage.do?flag=1@@fsId=";
        }else if(busTyp == '065'){//资管结清
			_formUrl = "/project/financialInst/showZGSettlePage.do?bankAct=1-1-1-1@@processInstanceId="+pinstId+"@@paySchId=";
		}else if(busTyp == '063'){//狮桥在线结清
            _formUrl = "/settlement/jumpExtraFlowPage.do?onlinePageType=flow@@processInstanceId="+pinstId+"@@paySchId=";
        }else if (busTyp == 'STL001') { // 结清通用流程
            _formUrl = "/settlement/bill/toAuditPage.do?processInstanceId="+pinstId+"@@paySchId=";
        } else if(busTyp == '066'){//非资管审核流程
            _formUrl = "/project/prjbscinfo/toModifyPage.do?fromPrjFlag=true@@detailFlag=true@@id=";
        }else if(busTyp=='070'){
			_formUrl = "/advBiz/flow/toAdditionalAuditPage.do?isAdvBiz=1@ctrlKey=3@isAuditNode=1@advBizRecId=";
		}else if(busTyp=='064'){
            _formUrl = "/institution/prjinsredminfo/toRedmInfoPage.do?redmId=";
        }else if(busTyp=='D16'){
            _formUrl = "/capital/cashDepositDeduction/toCashDepositDeductionPage.do?flag=6@paySchDId=";
        } else if (busTyp == '073') {
			_formUrl = "/changeApply/flow/toAdditionalInfoPage.do?isDetail_bk=1@@ctrlKey=3@@changeApplyId=";
		} else if (busTyp == '075') {
			_formUrl = "/changeApply/flow/toAdditionalInfoPageByHC.do?detailFlag=1@@changeApplyId=";
		} else if (busTyp == '071') {
			_formUrl = "/project/audit/toAdditionalInfoPage.do?isDetail=1@@processInstanceId=" + pinstId + "@@isExpFlow=1@@projectId=";
		} else if (busTyp == '079') {
			_formUrl = "/capPay/flow/toDyExpBizAdditionalInfoPage.do?isDyExpBiz=0@@prjPrdDtlId=";
		}
    	var params = "?pInsId="+pinstId+"&status="+audStsCd+"&businessKey="+dataId+"&formUrl="+_formUrl;
    	Add_navTab('tab_cst_invoice_flow_'+dataId+pinstId,'查看流程',"<%=path%>/flow/flow/toFlowShowPageFowBus.do"+params);
	}	
	
	//格式化时间
	function renderDate(rowdata, index, value){
		var dateStr = "";
		if(null != value){
			var date = new Date(value);
			dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DDHHMMSS);
		}
		return dateStr;
	}
	
</script>

</body>
</html>